﻿<UserControl x:Class="FR.SAFTAnalyserLite.Views.Tools.CreateHashFromUserInputView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:ad="http://avalondock.codeplex.com"
             mc:Ignorable="d" Background="{DynamicResource Background}"
             d:DesignHeight="400" d:DesignWidth="400">
    <UserControl.Resources>
        <ad:BoolToVisibilityConverter x:Key="visibilityConverter"/>
    </UserControl.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="25*"/>
            <ColumnDefinition Width="75*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="55"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Stretch" TextWrapping="Wrap" Margin="3"
                   Text="Esta ferramenta permite calcular a Hash com base nos valores individuais presentes na assinatura." />

        <TextBlock Text="Tipo:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Série:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Número:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Total:" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Datas:" Grid.Column="0" Grid.Row="5" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Hash anterior:" Grid.Column="0" Grid.Row="6" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Hash:" Grid.Column="0" Grid.Row="7" HorizontalAlignment="Right" Margin="3" />
        <TextBlock Text="Hash actual:" Grid.Column="0" Grid.Row="8" HorizontalAlignment="Right" Margin="3" Visibility="{Binding ValoresLidosDocumento, Converter={StaticResource visibilityConverter}}" />

        <ComboBox ItemsSource="{Binding TiposDocumentos}" SelectedItem="{Binding TipoDocumento}" Grid.Column="1" Grid.Row="1" Margin="3"/>
        <TextBox Text="{Binding SerieDocumento}" Grid.Column="1" Grid.Row="2" Margin="3"/>
        <toolkit:IntegerUpDown Value="{Binding NumeroDocumento}" Minimum="1" Grid.Column="1" Grid.Row="3" Margin="3"/>
        <toolkit:DecimalUpDown Value="{Binding TotalDocumento}" Minimum="0.01" Increment=".01" FormatString="c2" Grid.Column="1" Grid.Row="4" Margin="3"/>
        <DockPanel Grid.Column="1" Grid.Row="5">
            <toolkit:DateTimePicker Value="{Binding DataDocumento}" Format="Custom" FormatString="dd/MM/yyyy" Margin="3" DockPanel.Dock="Top" ToolTip="Data do documento"/>
            <toolkit:DateTimePicker Value="{Binding DataSistema}" Format="Custom" FormatString="dd/MM/yyyy HH:mm:ss" Margin="3" DockPanel.Dock="Bottom" ToolTip="Data do sistema"/>
        </DockPanel>
        <TextBox Text="{Binding HashAnterior}" Grid.Column="1" Grid.Row="6" Margin="3"/>
        <TextBox Text="{Binding HashDocumento}" Grid.Column="1" Grid.Row="7" Margin="3"/>
        <TextBox Text="{Binding HashActualDocumento}" Grid.Column="1" Grid.Row="8" Margin="3" Style="{StaticResource textbox}" Visibility="{Binding ValoresLidosDocumento, Converter={StaticResource visibilityConverter}}"/>
        <TextBox Text="{Binding Mensagem}" Grid.ColumnSpan="2" Grid.Row="9" Margin="3" Style="{StaticResource textbox}"/>

        <StackPanel Grid.ColumnSpan="2" Grid.Row="10" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <Button Command="{Binding DoCleanFieldsCommand}" Content="Limpar" Height="30" Width="90" Padding="5" Margin="3" />
            <Button Command="{Binding DoTestHashCommand}" Content="Testar Hash" Height="30" Width="90" Padding="5" Margin="3" />
            <Button Command="{Binding DoCreateHashCommand}" Content="Criar Hash" Height="30" Width="90" Padding="5" Margin="3" />
        </StackPanel>
    </Grid>
</UserControl>
